#ifndef __PROJECTFILEEDITORVIEW_H__H
#define __PROJECTFILEEDITORVIEW_H__H

#include <QtGui/QWidget>
#include <QtGui/QTreeView>
#include <QtGui/QCheckBox>

namespace Qt4ProjectManager
{
	namespace Internal
	{
		class ProEditorModel;
		class ProItemInfoManager;
		class ValueEditor;
	}
}

QT_FORWARD_DECLARE_CLASS(ProFile)

class DetailsView;

class ProjectFileEditorView : public QWidget
{
    Q_OBJECT
    Q_CLASSINFO("ClassID", "{d1d8294f-4bdd-4954-8e93-7ed624acc11e}")
    Q_CLASSINFO("InterfaceID", "{7cdc377d-655d-4d3d-a0dc-78fbfde1ae26}")
    Q_CLASSINFO("EventsID", "{a852f94a-d562-49d7-86ed-6969c8532b38}")
    Q_CLASSINFO("ToSuperClass", "QWidget")

public:
    ProjectFileEditorView(QWidget *parent = 0);
    ~ProjectFileEditorView();

    static Qt4ProjectManager::Internal::ProEditorModel *aquireModel(const QString &fileName);
    static void releaseModel(Qt4ProjectManager::Internal::ProEditorModel *editorModel);
    static void updateModel(Qt4ProjectManager::Internal::ProEditorModel *editorModel);

public Q_SLOTS:
    void showModel(const QString &fileName);
    void reload();
    bool save();

    bool isDirty() const;

    QString contents() const;

    bool isActionEnabled(int id);
    void triggerAction(int id);

Q_SIGNALS:
    void actionChanged(int id);
    void changed();

private Q_SLOTS:
    void modelReset();
    void enableAdvanced(bool enabled);

private:
    void adaptPalette(QWidget *widget);
    static QMap<QString, Qt4ProjectManager::Internal::ProEditorModel *> &modelMap();
    static QMap<Qt4ProjectManager::Internal::ProEditorModel *, int> &modelRefCount();

    Qt4ProjectManager::Internal::ProItemInfoManager *m_infomanager;
    Qt4ProjectManager::Internal::ProEditorModel *m_model;

    QTreeView *m_explorerView;
    DetailsView *m_detailsView;
    Qt4ProjectManager::Internal::ValueEditor *m_valueView;

    QCheckBox *m_advanced;
};

#endif //__PROJECTFILEEDITORVIEW_H__H
